<%-- 
    Document   : viewTest
    Created on : Nov 3, 2009, 9:30:57 AM
    Author     : Administrator
--%>

<%@page contentType="text/html" pageEncoding="UTF-8" import="java.sql.*,DAO.*" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
<%
            ResultTestName rsTestName = new ResultTestName();
%>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
        <link rel="stylesheet" type="text/css" media="screen" href="css/admin.css">
    </head>
    <body>
        <fieldset class="testView">
            <br>
        <table width="600">
            <tr>
                <td align="center">
                    <jsp:include flush="true" page="searchResultTestName.jsp" />
                </td>
            </tr>

        </table>
        <table border="1" width="600" class="sample">
            <thead>
                <tr>
                    <th width="20">ID</th>
                    <th width="120">UserName</th>
                    <th width="140">FullName</th>
                    <th width="140">Conter Test</th>
                    <th width="120">Status</th>
                </tr>
            </thead>
            <tbody>
                <%
            int i = 0;
            ResultSet rs = rsTestName.viewResult();
            ResultSet rsNotFound = rsTestName.viewResultTest();
            while (rs.next()) {
                
                %>
                <tr>
                    <td width="20"><%=i%></td>
                    <td width="120"><a href="displayNameTest.jsp?nameTest=<%=rs.getString("USERNAME")%>" ><%=rs.getString("UserName")%></a></td>
                    <td width="140"><%=rs.getString("FULLNAME")%></td>
                    <td width="140">
                        <%
                            out.println(rsTestName.viewResultTestCount(rs.getString("USERNAME")));
                        %>
                    </td>
                    <td width="120">
                        <%
                            if (rs.getBoolean("STATUS") == true) {
                        %>
                        <span style="color:red">Đang hoạt động</span>
                        <% } else {
                        %>
                        <span style="color:green">Ngừng họat động </span>
                        <% }%>
                    </td>
                </tr>

                <%
                i++;
                }
                %>
            </tbody>

        </table>
            <table width="600" class="sample">
            <tr>
                <td align="center">
                    <%
                        if(!rsNotFound.next())
                        {
                    %>
                    <span style="color:green">Không có bản ghi nào trong Database</span>
                    <% } %>
                </td>
            </tr>
        </table>
                <br>
        </fieldset>
    </body>
</html>
